#!/usr/local/bin/python3

import sys, getopt
import http.server
import gethandler
import rt

class http_handler(http.server.BaseHTTPRequestHandler):

	def do_GET(s):
		rt.log.info('GET ' + s.path)
		gethandler.process(s)

	def address_string(self):
		return ''

def run():
	rt.log.info('Starting httpserver')
	server_address = ('', rt.settings['port'])
	httpd = http.server.HTTPServer(server_address, http_handler)
	rt.log.info('Waiting requests')
	httpd.serve_forever()

if __name__ == "__main__":
	run()
